home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / graphic / byte2raw.s next >
Text File  |  1995-04-27  |  24KB  |  717 lines

  1. ;*********************************************************************
  2. ;* Here contains 68K assembler source code to convert color byte     *
  3. ;* information into data that is suitable for a system that          *
  4. ;* displays color in a multiple plane configuration. This code       *
  5. ;* assumes each plane is offset by 16 bits (2 bytes).                *
  6. ;* Available Functions:                                              *
  7. ;*                                                                   *
  8. ;* int byte2raw8(char *color_data, char *buffer); 256 color          *
  9. ;* int byte2raw4(char *color_data, char *buffer);  16 color          *
  10. ;* int byte2raw2(char *color_data, char *buffer);   4 color          *
  11. ;* int byte2raw1(char *color_data, char *buffer);   2 color          *
  12. ;* Return value is the number of bytes written to the buffer.        *
  13.  
  14.  
  15.      export byte2raw8
  16.      export byte2raw4
  17.      export byte2raw2
  18.      export byte2raw1
  19.      text
  20.  
  21. ;*********************************************************************
  22. ;* This will convert byte color into 8 plane pixel color.            *
  23. ;* Input 16 bytes of color information.                              *
  24. ;* Output 8 integers suitable for displaying on the ATARI.           *
  25. ;*********************************************************************
  26. ;* Function:
  27. ;* int byte2raw8(char *color_data, char *buffer);
  28. ;* color_data will be converted and placed into location buffer.
  29. ;* color_data = A0. (Must be word aligned)
  30. ;* buffer     = A1. (Must be word aligned)
  31.  
  32.      
  33. byte2raw8:
  34.      movem.l  D1-D7/A0-A2,-(A7)       ; Save used registers.
  35.  
  36.      moveq.l  #0,D0                   ; Now zero them out.
  37.      moveq.l  #0,D1                   ; Pixel color store here
  38.      moveq.l  #0,D2                   ; in registers D0-D3.
  39.      moveq.l  #0,D3
  40.      
  41.      move.l   #$1, D5                 ; Set up 'OR' mask.
  42.      move.l   D5,D6
  43.      swap     D6
  44.      
  45.      adda.l   #12,A0                  ; Start at end of data.
  46.      
  47.      ; In order to plot the data in the correct order. We need
  48.      ; to reverse the order of the 16 bytes of data.
  49.      
  50.      move.l   (A0),D4                 ; Get the last 4 bytes
  51.  
  52.      ror.w    #8,D4                   ; Convert to Intel format.
  53.      swap     D4
  54.      ror.w    #8,D4
  55.      
  56.      move     #3,D7                   ; Loop 4 times (4 bytes).
  57.  
  58. .loop1:     
  59.      lsl.l    #1,D4                   ; Bit was set?
  60.      bcc      .b12                    ; Branch if not.
  61.      or.l     D5,D3                   ; Set pixel on plane 7
  62. .b12:
  63.      lsl.l    #1,D4
  64.      bcc      .b13
  65.      or.l     D6,D3                   ; Plane 6
  66. .b13:          
  67.      lsl.l    #1,D4
  68.      bcc      .b14
  69.      or.l     D5,D2                   ; Plane 5
  70. .b14:     
  71.      lsl.l    #1,D4
  72.      bcc      .b15
  73.      or.l     D6,D2                   ; Plane 4
  74. .b15:
  75.      lsl.l    #1,D4
  76.      bcc      .b16
  77.      or.l     D5,D1                   ; Plane 3
  78. .b16:     
  79.      lsl.l    #1,D4
  80.      bcc      .b17
  81.      or.l     D6,D1                   ; Plane 2
  82. .b17:
  83.      lsl.l    #1,D4
  84.      bcc      .b18
  85.      or.l     D5,D0                   ; Plane 1
  86. .b18:
  87.      lsl.l    #1,D4
  88.      bcc      .b19
  89.      or.l     D6,D0                   ; Plane 0
  90. .b19:     
  91.      lsl.l    D5                      ; Shift odd and even plane
  92.      lsl.l    D6                      ; 'OR' mask.
  93.           
  94.      dbf     D7,.loop1                ; Branch if data still available.
  95.  
  96.      suba.l   #4,A0                   ; Adjust data pointer to left
  97.      move.l   (A0),D4                 ; and get the 3rd 4 byte group.
  98.  
  99.      ror.w    #8,D4                   ; Convert long word into Intel
  100.      swap     D4                      ; format.
  101.      ror.w    #8,D4
  102.  
  103.      move     #3,D7                   ; Set up loop counter.
  104.  
  105. .loop2:     
  106.      lsl.l    #1,D4
  107.      bcc      .b22
  108.      or.l     D5,D3                   ; Plane 7
  109. .b22:
  110.      lsl.l    #1,D4
  111.      bcc      .b23
  112.      or.l     D6,D3                   ; Plane 6
  113. .b23:          
  114.      lsl.l    #1,D4
  115.      bcc      .b24
  116.      or.l     D5,D2                   ; Plane 5
  117. .b24:     
  118.      lsl.l    #1,D4
  119.      bcc      .b25
  120.      or.l     D6,D2                   ; Plane 4
  121. .b25:
  122.      lsl.l    #1,D4
  123.      bcc      .b26
  124.      or.l     D5,D1                   ; Plane 3
  125. .b26:     
  126.      lsl.l    #1,D4
  127.      bcc      .b27
  128.      or.l     D6,D1                   ; Plane 2
  129. .b27:
  130.      lsl.l    #1,D4
  131.      bcc      .b28
  132.      or.l     D5,D0                   ; Plane 1
  133. .b28:
  134.      lsl.l    #1,D4
  135.      bcc      .b29
  136.      or.l     D6,D0                   ; Plane 0
  137. .b29:     
  138.      lsl.l    D5
  139.      lsl.l    D6
  140.           
  141.      dbf     D7,.loop2
  142.  
  143.      suba.l   #4,A0                   ; Adjust data pointer left and
  144.      move.l   (A0),D4                 ; get the 2nd 4 byte group.
  145.  
  146.      ror.w    #8,D4                   ; Convert to Intel format.
  147.      swap     D4
  148.      ror.w    #8,D4
  149.  
  150.      move     #3,D7                   ; Set up loop counter.
  151.  
  152. .loop3:     
  153.      lsl.l    #1,D4
  154.      bcc      .b32
  155.      or.l     D5,D3                   ; Plane 7
  156. .b32:
  157.      lsl.l    #1,D4
  158.      bcc      .b33
  159.      or.l     D6,D3                   ; Plane 6
  160. .b33:          
  161.      lsl.l    #1,D4
  162.      bcc      .b34
  163.      or.l     D5,D2                   ; Plane 5
  164. .b34:     
  165.      lsl.l    #1,D4
  166.      bcc      .b35
  167.      or.l     D6,D2                   ; Plane 4
  168. .b35:
  169.      lsl.l    #1,D4
  170.      bcc      .b36
  171.      or.l     D5,D1                   ; Plane 3
  172. .b36:     
  173.      lsl.l    #1,D4
  174.      bcc      .b37
  175.      or.l     D6,D1                   ; Plane 2
  176. .b37:
  177.      lsl.l    #1,D4
  178.      bcc      .b38
  179.      or.l     D5,D0                   ; Plane 1
  180. .b38:
  181.      lsl.l    #1,D4
  182.      bcc      .b39
  183.      or.l     D6,D0                   ; Plane 0
  184. .b39:     
  185.      lsl.l    D5
  186.      lsl.l    D6
  187.           
  188.      dbf     D7,.loop3
  189.  
  190.      suba.l   #4,A0                   ; Adjust data pointer left and
  191.      move.l   (A0),D4                 ; get the first 4 bytes.
  192.  
  193.      ror.w    #8,D4                   ; Shift data to intel format.
  194.      swap     D4
  195.      ror.w    #8,D4
  196.  
  197.      move     #3,D7                   ; Loop 4 times.
  198.  
  199. .loop4:     
  200.      lsl.l    #1,D4
  201.      bcc      .b42
  202.      or.l     D5,D3                   ; Plane 7
  203. .b42:
  204.      lsl.l    #1,D4
  205.      bcc      .b43
  206.      or.l     D6,D3                   ; Plane 6
  207. .b43:          
  208.      lsl.l    #1,D4
  209.      bcc      .b44
  210.      or.l     D5,D2                   ; Plane 5
  211. .b44:     
  212.      lsl.l    #1,D4
  213.      bcc      .b45
  214.      or.l     D6,D2                   ; Plane 4
  215. .b45:
  216.      lsl.l    #1,D4
  217.      bcc      .b46
  218.      or.l     D5,D1                   ; Plane 3
  219. .b46:     
  220.      lsl.l    #1,D4
  221.      bcc      .b47
  222.      or.l     D6,D1                   ; Plane 2
  223. .b47:
  224.      lsl.l    #1,D4
  225.      bcc      .b48
  226.      or.l     D5,D0                   ; Plane 1
  227. .b48:
  228.      lsl.l    #1,D4
  229.      bcc      .b49
  230.      or.l     D6,D0                   ; Plane 0
  231. .b49:     
  232.      lsl.l    D5
  233.      lsl.l    D6
  234.           
  235.      dbf     D7,.loop4
  236.  
  237.      move.l  D0,(A1)+                 ; Now move the data into
  238.      move.l  D1,(A1)+                 ; buffer.
  239.      move.l  D2,(A1)+
  240.      move.l  D3,(A1)
  241.  
  242.      movem.l (A7)+,D1-D7/A0-A2        ; Restore used registers.
  243.  
  244.      move.l  #16,D0                   ; Return number of bytes written.
  245.      rts                              ; Return to calling function.
  246.  
  247. ;*********************************************************************
  248. ;* This will convert byte color into 4 plane pixel color.            *
  249. ;* Input 16 bytes of color information.                              *
  250. ;* Output 4 integers suitable for displaying on the ATARI.           *
  251. ;*********************************************************************
  252. ;* Function:
  253. ;* int byte2raw4(char *color_data, char *buffer);
  254. ;* color_data will be converted and placed into location buffer.
  255. ;* color_data = A0. (Must be word aligned)
  256. ;* buffer     = A1. (Must be word aligned)
  257.  
  258. byte2raw4:
  259.      movem.l  D2-D7/A0-A2,-(A7)       ; Save used registers.
  260.  
  261.      moveq.l  #0,D2                   ; in registers D0-D3.
  262.      moveq.l  #0,D3
  263.      
  264.      move.l   #$1, D5                 ; Set up 'OR' mask.
  265.      move.l   D5,D6
  266.      swap     D6
  267.      
  268.      adda.l   #12,A0                  ; Start at end of data.
  269.      
  270.      ; In order to plot the data in the correct order. We need
  271.      ; to reverse the order of the 16 bytes of data.
  272.      
  273.      move.l   (A0),D4                 ; Get the last 4 bytes
  274.  
  275.      ror.w    #8,D4                   ; Convert to Intel format.
  276.      swap     D4
  277.      ror.w    #8,D4
  278.      
  279.      move     #3,D7                   ; Loop 4 times (4 bytes).
  280.  
  281. .loop1:     
  282.      lsl.l    #4,D4                   ; First four bits unused.
  283.      
  284.      lsl.l    #1,D4                   ; Bit was set?
  285.      bcc      .b12                    ; Branch if not.
  286.      or.l     D5,D3                   ; Set pixel on plane 3
  287. .b12:
  288.      lsl.l    #1,D4
  289.      bcc      .b13
  290.      or.l     D6,D3                   ; Plane 2
  291. .b13:          
  292.      lsl.l    #1,D4
  293.      bcc      .b14
  294.      or.l     D5,D2                   ; Plane 1
  295. .b14:     
  296.      lsl.l    #1,D4
  297.      bcc      .b15
  298.      or.l     D6,D2                   ; Plane 0
  299. .b15:
  300.      
  301.      lsl.l    D5                      ; Shift odd and even plane
  302.      lsl.l    D6                      ; 'OR' mask.
  303.           
  304.      dbf     D7,.loop1                ; Branch if data still available.
  305.  
  306.      suba.l   #4,A0                   ; Adjust data pointer to left
  307.      move.l   (A0),D4                 ; and get the 3rd 4 byte group.
  308.  
  309.      ror.w    #8,D4                   ; Convert long word into Intel
  310.      swap     D4                      ; format.
  311.      ror.w    #8,D4
  312.  
  313.      move     #3,D7                   ; Set up loop counter.
  314.  
  315. .loop2:     
  316.      lsl.l    #4,D4                   ; First 4 bits unused.
  317.      
  318.      lsl.l    #1,D4
  319.      bcc      .b22
  320.      or.l     D5,D3                   ; Plane 3
  321. .b22:
  322.      lsl.l    #1,D4
  323.      bcc      .b23
  324.      or.l     D6,D3                   ; Plane 2
  325. .b23:          
  326.      lsl.l    #1,D4
  327.      bcc      .b24
  328.      or.l     D5,D2                   ; Plane 1
  329. .b24:     
  330.      lsl.l    #1,D4
  331.      bcc      .b25
  332.      or.l     D6,D2                   ; Plane 0
  333. .b25:
  334.      lsl.l    D5
  335.      lsl.l    D6
  336.           
  337.      dbf     D7,.loop2
  338.  
  339.      suba.l   #4,A0                   ; Adjust data pointer left and
  340.      move.l   (A0),D4                 ; get the 2nd 4 byte group.
  341.  
  342.      ror.w    #8,D4                   ; Convert to Intel format.
  343.      swap     D4
  344.      ror.w    #8,D4
  345.  
  346.      move     #3,D7                   ; Set up loop counter.
  347.  
  348. .loop3:     
  349.      lsl.l    #4,D4                   ; First 4 bits unused.
  350.      
  351.      lsl.l    #1,D4
  352.      bcc      .b32
  353.      or.l     D5,D3                   ; Plane 3
  354. .b32:
  355.      lsl.l    #1,D4
  356.      bcc      .b33
  357.      or.l     D6,D3                   ; Plane 2
  358. .b33:          
  359.      lsl.l    #1,D4
  360.      bcc      .b34
  361.      or.l     D5,D2                   ; Plane 1
  362. .b34:     
  363.      lsl.l    #1,D4
  364.      bcc      .b35
  365.      or.l     D6,D2                   ; Plane 0
  366. .b35:
  367.      lsl.l    D5
  368.      lsl.l    D6
  369.           
  370.      dbf     D7,.loop3
  371.  
  372.      suba.l   #4,A0                   ; Adjust data pointer left and
  373.      move.l   (A0),D4                 ; get the first 4 bytes.
  374.  
  375.      ror.w    #8,D4                   ; Shift data to intel format.
  376.      swap     D4
  377.      ror.w    #8,D4
  378.  
  379.      move     #3,D7                   ; Loop 4 times.
  380.  
  381. .loop4:     
  382.      lsl.l    #4,D4                   ; First 4 bits unused.
  383.      
  384.      lsl.l    #1,D4
  385.      bcc      .b42
  386.      or.l     D5,D3                   ; Plane 3
  387. .b42:
  388.      lsl.l    #1,D4
  389.      bcc      .b43
  390.      or.l     D6,D3                   ; Plane 2
  391. .b43:          
  392.      lsl.l    #1,D4
  393.      bcc      .b44
  394.      or.l     D5,D2                   ; Plane 1
  395. .b44:     
  396.      lsl.l    #1,D4
  397.      bcc      .b45
  398.      or.l     D6,D2                   ; Plane 0
  399. .b45:
  400.      lsl.l    D5
  401.      lsl.l    D6
  402.           
  403.      dbf     D7,.loop4
  404.  
  405.      move.l  D2,(A1)+                 ; Now move the data into
  406.      move.l  D3,(A1)+                 ; buffer.
  407.  
  408.      movem.l (A7)+,D2-D7/A0-A2        ; Restore used registers.
  409.  
  410.      move.l  #8,D0                    ; Number of bytes written. 
  411.      rts                              ; Return to calling function.
  412.  
  413. ;*********************************************************************
  414. ;* This will convert byte color into 2 plane pixel color.            *
  415. ;* Input 16 bytes of color information.                              *
  416. ;* Output 2 integers suitable for displaying on the ATARI.           *
  417. ;*********************************************************************
  418. ;* Function:
  419. ;* int byte2raw2(char *color_data, char *buffer);
  420. ;* color_data will be converted and placed into location buffer.
  421. ;* color_data = A0. (Must be word aligned)
  422. ;* buffer     = A1. (Must be word aligned)
  423.  
  424. byte2raw2:
  425.      movem.l  D3-D7/A0-A2,-(A7)       ; Save used registers.
  426.  
  427.      moveq.l  #0,D3                   ; in registers D0-D3.
  428.      
  429.      move.l   #$1, D5                 ; Set up 'OR' mask.
  430.      move.l   D5,D6
  431.      swap     D6
  432.      
  433.      adda.l   #12,A0                  ; Start at end of data.
  434.      
  435.      ; In order to plot the data in the correct order. We need
  436.      ; to reverse the order of the 16 bytes of data.
  437.      
  438.      move.l   (A0),D4                 ; Get the last 4 bytes
  439.  
  440.      ror.w    #8,D4                   ; Convert to Intel format.
  441.      swap     D4
  442.      ror.w    #8,D4
  443.      
  444.      move     #3,D7                   ; Loop 4 times (4 bytes).
  445.  
  446. .loop1:     
  447.      lsl.l    #6,D4                   ; First four bits unused.
  448.      
  449.      lsl.l    #1,D4                   ; Bit was set?
  450.      bcc      .b12                    ; Branch if not.
  451.      or.l     D5,D3                   ; Set pixel on plane 1
  452. .b12:
  453.      lsl.l    #1,D4
  454.      bcc      .b13
  455.      or.l     D6,D3                   ; Plane 0
  456. .b13:          
  457.      
  458.      lsl.l    D5                      ; Shift odd and even plane
  459.      lsl.l    D6                      ; 'OR' mask.
  460.           
  461.      dbf     D7,.loop1                ; Branch if data still available.
  462.  
  463.      suba.l   #4,A0                   ; Adjust data pointer to left
  464.      move.l   (A0),D4                 ; and get the 3rd 4 byte group.
  465.  
  466.      ror.w    #8,D4                   ; Convert long word into Intel
  467.      swap     D4                      ; format.
  468.      ror.w    #8,D4
  469.  
  470.      move     #3,D7                   ; Set up loop counter.
  471.  
  472. .loop2:     
  473.      lsl.l    #6,D4                   ; First 6 bits unused.
  474.      
  475.      lsl.l    #1,D4
  476.      bcc      .b22
  477.      or.l     D5,D3                   ; Plane 1
  478. .b22:
  479.      lsl.l    #1,D4
  480.      bcc      .b23
  481.      or.l     D6,D3                   ; Plane 0
  482. .b23:          
  483.      lsl.l    D5
  484.      lsl.l    D6
  485.           
  486.      dbf     D7,.loop2
  487.  
  488.      suba.l   #4,A0                   ; Adjust data pointer left and
  489.      move.l   (A0),D4                 ; get the 2nd 4 byte group.
  490.  
  491.      ror.w    #8,D4                   ; Convert to Intel format.
  492.      swap     D4
  493.      ror.w    #8,D4
  494.  
  495.      move     #3,D7                   ; Set up loop counter.
  496.  
  497. .loop3:     
  498.      lsl.l    #6,D4                   ; First 6 bits unused.
  499.      
  500.      lsl.l    #1,D4
  501.      bcc      .b32
  502.      or.l     D5,D3                   ; Plane 1
  503. .b32:
  504.      lsl.l    #1,D4
  505.      bcc      .b33
  506.      or.l     D6,D3                   ; Plane 0
  507. .b33:          
  508.      lsl.l    D5
  509.      lsl.l    D6
  510.           
  511.      dbf     D7,.loop3
  512.  
  513.      suba.l   #4,A0                   ; Adjust data pointer left and
  514.      move.l   (A0),D4                 ; get the first 4 bytes.
  515.  
  516.      ror.w    #8,D4                   ; Shift data to intel format.
  517.      swap     D4
  518.      ror.w    #8,D4
  519.  
  520.      move     #3,D7                   ; Loop 4 times.
  521.  
  522. .loop4:     
  523.      lsl.l    #6,D4                   ; First 4 bits unused.
  524.      
  525.      lsl.l    #1,D4
  526.      bcc      .b42
  527.      or.l     D5,D3                   ; Plane 3
  528. .b42:
  529.      lsl.l    #1,D4
  530.      bcc      .b43
  531.      or.l     D6,D3                   ; Plane 2
  532. .b43:          
  533.      lsl.l    D5
  534.      lsl.l    D6
  535.           
  536.      dbf     D7,.loop4
  537.  
  538.      move.l  D3,(A1)                  ; Now move the data into
  539.                                       ; buffer.
  540.      movem.l (A7)+,D3-D7/A0-A2        ; Restore used registers.
  541.  
  542.      move.l  #4,D0                    ; Number of bytes written. 
  543.      rts                              ; Return to calling function.
  544.  
  545. ;*********************************************************************
  546. ;* This will convert byte color into 2 plane pixel color.            *
  547. ;* Input 16 bytes of color information.                              *
  548. ;* Output 1 integers suitable for displaying on the ATARI.           *
  549. ;*********************************************************************
  550. ;* Function:
  551. ;* int byte2raw1(char *color_data, char *buffer);
  552. ;* color_data will be converted and placed into location buffer.
  553. ;* color_data = A0. (Must be word aligned)
  554. ;* buffer     = A1. (Must be word aligned)
  555.  
  556. byte2raw1:
  557.      movem.l  D3-D7/A0-A2,-(A7)       ; Save used registers.
  558.  
  559.      moveq.l  #0,D3                   ; Zero register D3.
  560.  
  561.      ; In order to plot the data in the correct order. We need
  562.      ; to reverse the order of the 16 bytes of data.
  563.  
  564.      adda.l   #12,A0                  ; Start at end of data.     
  565.      move.l   (A0),D4                 ; Get the last 4 bytes
  566.  
  567.      ror.w    #8,D4                   ; Convert to Intel format.
  568.      swap     D4
  569.      ror.w    #8,D4
  570.           
  571.      move.l   #$1, D5                 ; Set up 'OR' mask.
  572.      lsl.l    #7,D4                   ; First 7 bits unused.
  573.      
  574.      lsl.l    #1,D4                   ; Bit was set?
  575.      bcc      .b12                    ; Branch if not.
  576.      or.l     D5,D3                   ; Set pixel on plane 1
  577. .b12:    
  578.      lsl.l    D5                      ; Shift 'OR' mask.
  579.      lsl.l    #7,D4                   ; First 7 bits unused.
  580.      
  581.      lsl.l    #1,D4                   ; Bit was set?
  582.      bcc      .b13                    ; Branch if not.
  583.      or.l     D5,D3                   ; Set pixel on plane 1
  584. .b13:    
  585.      lsl.l    D5                      ; Shift 'OR' mask.
  586.      lsl.l    #7,D4                   ; First 7 bits unused.
  587.      
  588.      lsl.l    #1,D4                   ; Bit was set?
  589.      bcc      .b14                    ; Branch if not.
  590.      or.l     D5,D3                   ; Set pixel on plane 1
  591. .b14:    
  592.      lsl.l    D5                      ; Shift 'OR' mask.
  593.      lsl.l    #7,D4                   ; First 7 bits unused.
  594.      
  595.      lsl.l    #1,D4                   ; Bit was set?
  596.      bcc      .b15                    ; Branch if not.
  597.      or.l     D5,D3                   ; Set pixel on plane 1
  598. .b15:    
  599.  
  600.      subq.l   #4,A0
  601.      move.l   (A0),D4                 ; Get 4 bytes
  602.  
  603.      ror.w    #8,D4                   ; Convert to Intel format.
  604.      swap     D4
  605.      ror.w    #8,D4
  606.           
  607.      lsl.l    D5                      ; Shift 'OR' mask.
  608.      lsl.l    #7,D4                   ; First 7 bits unused.
  609.      
  610.      lsl.l    #1,D4                   ; Bit was set?
  611.      bcc      .b22                    ; Branch if not.
  612.      or.l     D5,D3                   ; Set pixel on plane 1
  613. .b22:    
  614.      lsl.l    D5                      ; Shift 'OR' mask.
  615.      lsl.l    #7,D4                   ; First 7 bits unused.
  616.      
  617.      lsl.l    #1,D4                   ; Bit was set?
  618.      bcc      .b23                    ; Branch if not.
  619.      or.l     D5,D3                   ; Set pixel on plane 1
  620. .b23:    
  621.      lsl.l    D5                      ; Shift 'OR' mask.
  622.      lsl.l    #7,D4                   ; First 7 bits unused.
  623.      
  624.      lsl.l    #1,D4                   ; Bit was set?
  625.      bcc      .b24                    ; Branch if not.
  626.      or.l     D5,D3                   ; Set pixel on plane 1
  627. .b24:    
  628.      lsl.l    D5                      ; Shift 'OR' mask.
  629.      lsl.l    #7,D4                   ; First 7 bits unused.
  630.      
  631.      lsl.l    #1,D4                   ; Bit was set?
  632.      bcc      .b25                    ; Branch if not.
  633.      or.l     D5,D3                   ; Set pixel on plane 1
  634. .b25:    
  635.  
  636.      subq.l   #4,A0
  637.      move.l   (A0),D4                 ; Get 4 bytes
  638.  
  639.      ror.w    #8,D4                   ; Convert to Intel format.
  640.      swap     D4
  641.      ror.w    #8,D4
  642.           
  643.      lsl.l    D5                      ; Shift 'OR' mask.
  644.      lsl.l    #7,D4                   ; First 7 bits unused.
  645.      
  646.      lsl.l    #1,D4                   ; Bit was set?
  647.      bcc      .b32                    ; Branch if not.
  648.      or.l     D5,D3                   ; Set pixel on plane 1
  649. .b32:    
  650.      lsl.l    D5                      ; Shift 'OR' mask.
  651.      lsl.l    #7,D4                   ; First 7 bits unused.
  652.      
  653.      lsl.l    #1,D4                   ; Bit was set?
  654.      bcc      .b33                    ; Branch if not.
  655.      or.l     D5,D3                   ; Set pixel on plane 1
  656. .b33:    
  657.      lsl.l    D5                      ; Shift 'OR' mask.
  658.      lsl.l    #7,D4                   ; First 7 bits unused.
  659.      
  660.      lsl.l    #1,D4                   ; Bit was set?
  661.      bcc      .b34                    ; Branch if not.
  662.      or.l     D5,D3                   ; Set pixel on plane 1
  663. .b34:    
  664.      lsl.l    D5                      ; Shift 'OR' mask.
  665.      lsl.l    #7,D4                   ; First 7 bits unused.
  666.      
  667.      lsl.l    #1,D4                   ; Bit was set?
  668.      bcc      .b35                    ; Branch if not.
  669.      or.l     D5,D3                   ; Set pixel on plane 1
  670. .b35:    
  671.           
  672.      subq.l   #4,A0
  673.      move.l   (A0),D4                 ; Get 4 bytes
  674.  
  675.      ror.w    #8,D4                   ; Convert to Intel format.
  676.      swap     D4
  677.      ror.w    #8,D4
  678.           
  679.      lsl.l    D5                      ; Shift 'OR' mask.
  680.      lsl.l    #7,D4                   ; First 7 bits unused.
  681.      
  682.      lsl.l    #1,D4                   ; Bit was set?
  683.      bcc      .b42                    ; Branch if not.
  684.      or.l     D5,D3                   ; Set pixel on plane 1
  685. .b42:    
  686.      lsl.l    D5                      ; Shift 'OR' mask.
  687.      lsl.l    #7,D4                   ; First 7 bits unused.
  688.      
  689.      lsl.l    #1,D4                   ; Bit was set?
  690.      bcc      .b43                    ; Branch if not.
  691.      or.l     D5,D3                   ; Set pixel on plane 1
  692. .b43:    
  693.      lsl.l    D5                      ; Shift 'OR' mask.
  694.      lsl.l    #7,D4                   ; First 7 bits unused.
  695.      
  696.      lsl.l    #1,D4                   ; Bit was set?
  697.      bcc      .b44                    ; Branch if not.
  698.      or.l     D5,D3                   ; Set pixel on plane 1
  699. .b44:    
  700.      lsl.l    D5                      ; Shift 'OR' mask.
  701.      lsl.l    #7,D4                   ; First 7 bits unused.
  702.      
  703.      lsl.l    #1,D4                   ; Bit was set?
  704.      bcc      .b45                    ; Branch if not.
  705.      or.l     D5,D3                   ; Set pixel on plane 1
  706. .b45:    
  707.  
  708.      move.w  D3,(A1)                  ; Now move the data into
  709.                                       ; buffer.
  710.      movem.l (A7)+,D3-D7/A0-A2        ; Restore used registers.
  711.  
  712.      move.l  #2,D0                    ; Number of bytes written. 
  713.      rts                              ; Return to calling function.
  714.                 
  715. end_loop:
  716.      bra end_loop                     ; just in case.
  717.      end